﻿@*@model SCMS.UI.Models.Request4Advance
@{AjaxOptions ajaxOpts = new AjaxOptions
  {
      UpdateTargetId = "R4ADiv",
      LoadingElementId = "loading",
      HttpMethod = "Post",
      Url = Url.Action("SaveR4A"),
      OnSuccess = "javascript:usermsg()",
      OnFailure = "javascript:errormsg()"
  };}
<script src="@Url.Content("~/Scripts/js/jquery-1.7.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Ajax.BeginForm(null,null,ajaxOpts, new { @class = "form" }))
{
    @Html.ValidationSummary(true)
    <div style="width: 90%; border: 1px solid grey; border-radius: 10px 10px 10px 10px;
        text-align: center;" class="partialViewCard">
        <div style="width: 100%; border-radius: 10px 10px 0px 0px; text-align: center;" class="gridheader">
            <h3>
                &nbsp;</h3>
        </div>
        <fieldset>
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        @Model.EntityAdvanceRqst.AdvanceType
                        @Html.HiddenFor(x => x.EntityAdvanceRqst.AdvanceType)
                    </td>
                    <td>
                        Date
                    </td>
                    <td>
                        Currency
                    </td>
                </tr>
                <tr>
                    <td>
                        @Html.DropDownListFor(x => x.ReferenceIdPo, Model.dropdownlist, "- please select -", new { id = "dplpo", onchange = "javascript:GetR4AdvanceDetails2(this)" })
                    </td>
                    <td>
                        @Html.EditorFor(m => m.EntityAdvanceRqst.RequestDate)
                    </td>
                    <td>
                        @Html.DropDownListFor(x => x.EntityAdvanceRqst.CurrencyId, Model.Currencies, "- please select -")
                    </td>
                </tr>
                <tr>
                    <td>
                        Payment Request No.
                    </td>
                    <td>
                        Payment Type
                    </td>
                    <td>
                        Total Payment
                    </td>
                </tr>
                <tr>
                    <td>
                        @Html.TextBoxFor(m => m.EntityAdvanceRqst.RefNumber, new { @readonly = "readonly" })
                    </td>
                    <td>
                        @Html.DropDownListFor(x => x.EntityAdvanceRqst.PaymentTypeId, Model.Paymenttype, "- please select -")
                    </td>
                    <td>
                        @Html.EditorFor(m => m.EntityAdvanceRqst.TotalAdvance)
                    </td>
                </tr>
                <tr>
                    <td style="text-align: center;">
                        Subject/Purpose
                    </td>
                    <td colspan="2">
                        @Html.TextBoxFor(m => m.EntityAdvanceRqst.Subject, new { @class = "textcontent field text" })
                    </td>
                </tr>
                <tr>
                    <td style="width: 30%; text-align: center;">
                        Payment To:
                    </td>
                    <td colspan="2" style="width: 40%;">
                        @Html.DropDownListFor(x => x.EntityAdvanceRqst.PaidTo, Model.Suppliers, "- please select -", new { @class = "textcontent" })
                    </td>
                </tr>
                <tr>
                    <td style="width: 30%; text-align: center;">
                        Payment Terms:
                    </td>
                    <td colspan="2" style="width: 40%;">
                        @Html.DropDownListFor(x => x.EntityAdvanceRqst.PaymentTermId, Model.PaymentTerms, "- please select -", new { @class = "textcontent" })
                    </td>
                </tr>
                <tr>
                    <td style="text-align: center;">
                        Request For:
                    </td>
                    <td colspan="2" style="text-align: left;">
                        <table>
                            <tr>
                                <td>
                                    <div>
                                        @Html.RadioButtonFor(x => x.EntityAdvanceRqst.RequestFor, "FullPayment")
                                        Full Payment</div>
                                </td>
                                <td>
                                    <div>
                                        @Html.RadioButtonFor(x => x.EntityAdvanceRqst.RequestFor, "Rate_Instalment")
                                        Rate/Instalment</div>
                                </td>
                                <td>
                                    <div>
                                        @Html.RadioButtonFor(x => x.EntityAdvanceRqst.RequestFor, "Adv_Payment_percentage")
                                        Adv. Payment %</div>
                                </td>
                                <td>
                                    <div>
                                        @Html.RadioButtonFor(x => x.EntityAdvanceRqst.RequestFor, "Adv_Final_Payment_percentage")
                                        Adv. Final Payment %</div>
                                </td>
                            </tr>
                        </table>
                        @Html.ValidationMessageFor(x => x.EntityAdvanceRqst.RequestFor)
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        <table width="99%" align="center" cellspacing="0" cellpadding="0" border="1" style="border: 1px solid grey;
                            border-collapse: collapse; padding: 5px; font-size: 12px;">
                            <tr class="gridheader">
                                <th colspan="3" align="center">
                                    Payment Details
                                </th>
                            </tr>
                            @if (Model.paymentdetailz.Count() > 0)
                            {
                                <tr>
                                    <th style="width: 25%;">
                                        Project No
                                    </th>
                                    <th style="width: 25%;">
                                        Budget Line
                                    </th>
                                    <th style="width: 20%;">
                                        Amount
                                    </th>
                                </tr>
                                for (int i = 0; i < Model.paymentdetailz.Count; i++)
                                {
                                <tr>
                                    <td>
                                        @Model.paymentdetailz[i].projectNo
                                        @Html.HiddenFor(x => x.paymentdetailz[i].PorjectNoId)
                                    </td>
                                    <td>@Model.paymentdetailz[i].BudgetLine
                                        @Html.HiddenFor(x => x.paymentdetailz[i].BudgetLineId)
                                    </td>
                                    <td>
                                        @Html.TextBoxFor(x => x.paymentdetailz[i].Amount)
                                    </td>
                                </tr>
                                }
                            }
                        </table>
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td style="text-align: center;">
                        Remarks:
                    </td>
                    <td colspan="2">
                        @Html.TextAreaFor(m => m.EntityAdvanceRqst.Remarks, new { @class = "textcontent" })
                    </td>
                </tr>
            </table>
            <hr />
            <p>
                <input type="submit" class="btn green"  value="Create" />
            </p>
            <div style="text-align: center;">
                @if (Model.IsSaved)
                {
                  
                    <span class="action_message">@Model.usermsg</span>
                }
                else
                {<span class="field-validation-error">@Model.usermsg</span> }
            </div>
        </fieldset>
    </div>
}
<div>
    @Ajax.ActionLink("Back", "ChooseR4AType", new { id = "ChooseR4AType" }, new AjaxOptions
               {
                   UpdateTargetId = "R4ADiv",
                   LoadingElementId = "loading",
                   Url = Url.Action("ChooseR4AType")
               })
</div>
*@